package com.rmc.verifycode;

import java.util.HashMap;
import java.util.Map;

import com.rmc.verifycode.CharGroup;

public enum CharGroupFactory {

	FACTORY;

	private CharGroupFactory() {}

	private Map<String, CharGroup> charGroups = new HashMap<String, CharGroup>();

	public CharGroup getCharGroup(String id) {
		CharGroup charGroup = charGroups.get(id);
		if (charGroup == null) {
			charGroup = CharGroup.load(id);
			charGroups.put(charGroup.getId(), charGroup);
		}
		return charGroup;
	}
}
